import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../my_app_view_model.dart';

///资源库的状态管理
class CustomizationViewModel extends ChangeNotifier {
  int pageTag;
  bool identity;

  List<Widget> listTab = [
    Tab(text: "视频"),
    Tab(text: "文件"),
  ];
  String textTabBar;

  BuildContext me;

  bool screenBool = false;

  CustomizationViewModel(this.me, {this.pageTag}) {
    MyAppViewModel myAppViewModel = Provider.of<MyAppViewModel>(this.me);
    identity = myAppViewModel.identity;
  }

  initView() {
    if (identity) {
      switch (pageTag) {
        case 0:
          textTabBar = "资源库";
          break;
        case 1:
          textTabBar = "我的收藏";
          break;
      }
    } else {
      pageTag = 3;
      textTabBar = "定制学";
      listTab.clear();
      listTab.add(Tab(text: "我的课程"));
      listTab.add(Tab(text: "推荐课程"));
    }
    notifyListeners();
  }

  //筛选按钮
  screenOnTap() {
    screenBool = !screenBool;
    notifyListeners();
  }
}
